package personal.vap.route.tracker.server.test;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import personal.vap.route.tracker.server.Coordinate;
import personal.vap.route.tracker.server.Route;

public class Utils {
  public static Route[] getTestRoute(String nameBase, int count) {
    Route[] toReturn = new Route[count];
    for (int i = 0; i < toReturn.length; i++) {
      toReturn[i] = new Route();
      toReturn[i].name = nameBase + " " + i;
      toReturn[i].startTime = new Date();
      toReturn[i].endtime = new Date(System.currentTimeMillis() + (i+1)*60*1000);
      List<Coordinate> coordinates = getCoordinates(i);
      toReturn[i].route = coordinates;
    }
    return toReturn;
  }

  public static Route getSingleRoute(String name) {
    Route route = new Route();
    route = new Route();
    route.name = name;
    route.startTime = new Date();
    route.endtime = new Date(System.currentTimeMillis() + 60*60*1000);
    List<Coordinate> coordinates = getCoordinates(0);
    route.route = coordinates;
    
    return route;
  }
  
  public static List<Coordinate> getCoordinates(int index) {
    List<Coordinate> coordinates= new ArrayList<Coordinate>();
    for (int i = 0; i < 20; i++) {
      Coordinate c = new Coordinate();
      c.altitude = index + i;
      c.lattitude = (index + i) % 90;
      c.longitude = (index + i) % 180;
      coordinates.add(c);
    }
    return coordinates;
  }

}
